// JackCompiler.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "CompilationEngine.h"

using namespace std;

int main(int argc, _TCHAR* argv[])
{
	// validate usage syntax
	if(argc==2){
		// get the filename
		string jack=(char*)argv[1];
		string vm=(char*)argv[1];
		// create the vm - out filename
		vm.erase(vm.size()-5,5);
		vm+=".vm";
		// go to main buisness - compile!
		CompilationEngine EngineInstance((char*)jack.c_str()); // strings converted to sz
		if (EngineInstance.CompileClass() ==1)
		{
			// let the user know we are done
			cout << jack << " successfully compiled to " << vm << "\n";
		}
	}
	else
		// let the user know the compiler syntax
		cout << "Error \n Syntax is: JackCompiler.exe <jack file name>\n";
	cout << "press Enter to quit...\n";
	getchar();
	return false;
}

